import { invoke } from "@tauri-apps/api"

export default {

    open: async (name: string) => {
        return invoke('open_port', { name });
    },

    write: async (buf: number[]) => {
        return invoke('write_port', { buf });
    },

    activePorts: async () => {
        return await invoke('active_ports') as string[]
    },

    isOpen: async () => {
        return await invoke('is_port_open') as boolean
    },

    close: async () => {
        return await invoke('close_port');
    }
}

